<?php
namespace app\admin\model;
use think\Model;
class Status extends Model{
	
	protected $table = 'house_status';
	protected $pk = 's_id';
	
	
	public function add(){
		
		$data=[
		  'n_id'=>input("param.n_id"),
		  'r_id'=>input("param.r_id"),
		  's_user'=>input("param.s_user"),
		  's_name'=>input("param.s_name"),
		   's_pay'=>input("param.p_id"),
		   'start_time'=>input("start_time"),
		   'stop_time'=>input("param.stop_time"),
		   'status'=>input("param.status"),
		   'guanliyuan'=>input("param.guanliyuan")
			];
			
		$sta = new Status();
		
		$result = $sta->save($data);
		return $result;
	}
	
	public function upd(){
		
		$sta = new Status();
		$result = $sta->save([
		  
		  'n_id'=>input("param.n_id"),
		  'r_id'=>input("param.r_id"),
		  's_user'=>input("param.s_user"),
		  's_name'=>input("param.s_name"),
		   'p_id'=>input("param.p_id"),
		   'start_time'=>input("start_time"),
		   'stop_time'=>input("param.stop_time"),
		   'status'=>input("param.status"),
		   'guanliyuan'=>input("param.guanliyuan")
		   
		],['s_id'=>input('param.s_id')]);
		
		return $result;
	}
	public function number()
    {
        return $this->hasOne('number','n_id','n_id');
    }
    public function rom()
    {
        return $this->hasOne('rom','r_id','r_id');
    }
    public function pay()
    {
        return $this->hasOne('pay','p_id','s_pay');
    }
}
?>